<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<jsp:include page="/view/btlib.jsp"></jsp:include>
<style type="text/css">
.profile-container .profile-header .profile-info {
    min-height: 175px;
    border-right: 0!important;
    padding: 35px 10px 35px 50px;
}
.profile-container .profile-header {
    margin: 0px -4% 0;
}

.task-row {
    margin-right: -15px;
    margin-left: -15px;
    margin-top: 25px;
}

.logo_text{
    padding-bottom: 0;
    min-height: 100%;
    font-family: 'Open Sans','Segoe UI';
    font-size: 27px;
    color: #f5f5f5;
    font-weight: 600;
}

.btn-group>.btn, .btn-group>.btn+.btn {
    margin: 0% 0% 0% 12%;
}

#page123{margin-top:10px}
#actionList table thead tr th:first-child{text-align:center}
ul.pagination{clear:both!important;}
.navbar .navbar-inner .a-group{margin-right: 30px;}
.navbar .navbar-inner .a-group  a{color: #eee;cursor: pointer;line-height: 50px;min-width:100px;display: inline-block;}
.navbar .navbar-inner .a-group a:hover{text-decoration:none}
.navbar .navbar-inner .a-group a span{width: 15px;height: 15px;border-radius: 15px;background:#999999;position: relative;display: inline-block;line-height: 45px;cursor: pointer;}
.mt0{margin-top: 0px!important}
.border-radius-5{border-radius: 2px}
#task_list {height: 460px;}
#task_list li{position: relative; height: 150px; border-bottom: 1px solid #e5e5e5}
.select2-container .select2-choice .select2-arrow{top:7px!important}
.mr5{margin-right: 5px}.ml5{margin-left: 5px}
#task{margin:0 auto;}


*{padding: 0px; margin: 0px;}
.content{
	width: 100%; 
	height: 0px;
	background:#2dc3e8;
}
.content .select{
	width: 0px; 
	height: 0px; 
	background: #FFFFFF; 
	margin: 0% 0% 0% 0%;
	position: relative;
	cursor: pointer;
}
.content .select::after{
	content: "";
	display: block;
	border-left: 1px solid #D0D0D0;
	border-bottom: 1px solid #D0D0D0;
	top: 12px;
	right: 12px;
	transform: rotate(-46deg);
	transition: all .3s ease-in;
}
.content .select p{
width: 148px;
   line-height: 51px;
   font-size: 12px;
   font-family: "microsoft yahei";
   color:#eee;
   padding: 0px 0px;
}
.content .select ul{
	width: 99px;
	display: block;
	font-size: 16px;
	background: #FFFFFF;
	position: absolute;
	top: 40px;
	left: 0px;
	max-height: 0px;
	overflow: hidden;
	transition: max-height .3s ease-in;
}
.content .select ul li{
	width: 100%;
	height: 30px;
	line-height: 30px;
	padding: 0px 15px;
	list-style: none;
	color: #666666;
}
.content .select ul li.Selected{
	background:#2dc3e8;
	color: #FFFFFF;
}
.content .select ul li:hover{
	background: #D0D0D0;
}
@-webkit-keyframes slide-down{
	0%{transform: scale(1,0);}
	25%{transform: scale(1,1.2);}
	50%{transform: scale(1,0.85);}
	75%{transform: scale(1,1.05);}
	100%{transform: scale(1,1);}
}

.content .select.open ul{
	max-height: 250px;
	transform-origin: 50% 0;
	-webkit-animation: slide-down .5s ease-in;
	transition: max-height .2s ease-in;
}
.content .select.open::after{
	transform: rotate(134deg);
	transition: all .3s ease-in;
	top: 18px;
	
}
</style>
<script>
	$(function(){
		$(".select p").click(function(e){
			$(".select").toggleClass('open');
			e.stopPropagation();
		});
		
		$(".content .select ul li").click(function(e){
			var _this=$(this);
			$(".select > p").text(_this.attr('data-value'));
			_this.addClass("Selected").siblings().removeClass("Selected");
			$(".select").removeClass("open");
			e.stopPropagation();
		});
		
		$(document).on('click',function(){
			$(".select").removeClass("open");
		})
		
	});
</script>
<title>首页1</title>
</head>
<body>

<div class="navbar">
        <div class="navbar-inner">
            <div class="navbar-container">
				<div class="navbar-header pull-left">
					<div class = "logo_text">
						实践管理平台
					</div>
				</div>
				 
                <!-- Account Area and Settings -->
              
             
                <div class="a-group pull-right row">
                  <div class="content">
					<div class="select">
						<p data-value="" class=""><i class="fa fa-suitcase mr5"></i>
                     	发布管理
					  <i class="fa fa-sort-desc ml5"></i></p>
						<ul>
							 <a href="index.jsp"><li data-value=" " class="Selected ">后台管理</li></a>
							<a href="swindex.jsp"><li data-value="任务新增">任务新增</li></a>
							<a href="finished.jsp"><li data-value="发布管理">发布管理</li></a>
							<a href="visited.jsp"><li data-value="回访记录">回访记录</li></a>
							<a href="checked.jsp"><li data-value="审核">审核</li></a>
							<a href="archive.jsp"><li data-value="归档">归档</li></a>
							
						</ul>
					</div>
				</div>
                   <a class=" ">
                     </a>
                      <a class=" "><i class="fa  fa-envelope-o mr5"></i>消息 <i class="fa fa-sort-desc ml5"></i></a>
                      <a class=""><p id="loginName"> </p></a>
                </div>
                <!-- /Account Area and Settings -->
               

                
            </div>
        </div>
    </div>

<div class="main-container container-fluid">
    <!-- 页面容器 -->
    <div class="page-container">
        <!-- 页面内容 -->
        <div class="page-body">
            <div class="row">
                <div class="col-md-3 ">
                    <div class="profile-container">
                        <div class="profile-header row border-radius-5" >
                            <div class="col-lg-12 col-md-12 col-sm-12 text-center row">
                                <img src="assets/bootstrap/img/avatars/divyia.jpg" alt="" class="header-avatar">
                            </div>
                            <div class="col-lg-12 col-md-12 col-sm-12 profile-info row">
                                <div class="col-lg-2 col-md-2 col-sm-2"></div>
                                <div id="bannerUserName" class="header-fullname col-lg-4 col-md-4 col-sm-4 mt0">张三</div>
                                <div class="header-information col-lg-4 col-md-4 col-sm-4 mt0">
                                    客服 069
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-2"></div>
                            </div>
                        </div>
                    </div>

                    <div class="task-row row">
                        <div class="widget">
                                <div class="widget-header bordered-bottom bordered-themeprimary">
                                    <i class="widget-icon fa fa-tasks themeprimary"></i>
                                    <span class="widget-caption themeprimary" style="margin-top: -30px;">任务列表</span>
                                </div><!--Widget Header-->
                                <div class="widget-body">
                                    <div class="widget-main no-padding">
                                        <div class="task-container">
                                            <ul class="tasks-list" id="task_list">
                                               
                                            </ul>
                                            <div id="task"></div>
                                        </div>
                                    </div><!--控件容器-->
                                </div><!--控件内容-->
                             </div>
                    </div>
                </div>
                <!-- 输入框 -->
                <div class="col-md-6">
                <form id="form" action="post">
                
                    <div class="well with-header">
                        <div class="header bordered-palegreen">
                        	<div class="DTTT btn-group pull-left">
                        	<p style="position:relative;top:8px;left: 8px;">任务录入</p>
                        	</div>
                        
                        </div>

                         <div class="row">
                        	<div class="col-md-4">
                              		<td>任务编号</td><br>
                                    <td><input id="taskNum" name="taskNum"  class="textbox"   readonly="true"   style="height: 22px;"  /></td>
                                </tr>
                        	</div>
                           
                            <div class="col-md-4">
                             <th>创建人</th><br>
                                    <td><input id="createPerson" name="createPerson" class="textbox"     style="height: 22px;"  /></td>
                                </tr>
                            </div>

                            <div class="col-md-4">
                             <th>发布时间</th><br>
                                <td><input id="sendTime" name="sendTime"  class="easyui-datetimebox" required = "required"  style="width: 180px;" /></td>
                             </tr>
                            </div>
                        </div>
                        <hr class="wide">
                        <div class="row">
	                        	<div class="col-md-4">
                              	  <th>项目简称</th><br>
                                    <td><input id="taskName" name="taskName"  class="easyui-textbox"      style="height: 22px;"  /></td>
                                    <td><input id="id" name="id"  class="textbox"      style="height: 22px; display:none;"  /></td>
                                </tr>
	                        	</div>
	                           
	                            <div class="col-md-4">
	                            <th>客户名称</th><br>
                                    <td><input id="customerId" name="customerId"  class="easyui-textbox"  required = "required"    style="height: 22px;"  /></td>
                                </tr>
	                            </div>
	                          <div class="col-md-4">
	                              <tr>
		                            <th>工程师</th><br>
                                    <td><input id="executorId"  name ="executorId"  class="easyui-textbox" required = "required"    style="height: 22px;"  /></td>
                                </tr>
                        	</div>
	                          
                        </div>
                        
                        <hr class="wide">
                        
                        <div class="row">
                        	<div class="col-md-4">
                               <tr>
		                            <th>所在省市</th><br>
                                    <td><input id="province" name="province"   class="textbox"   required = "required" style="height: 22px;" /></td>
                                </tr>
                        	</div>
                           
                            <div class="col-md-4">
                             <tr>
		                            <th>所在县市</th><br>
                                    <td><input id="country" name="country"  class="textbox"  required = "required"   style="height: 22px;"  /></td>
                                </tr>
                            </div>

                            <div class="col-md-4">
                               <tr>
		                            <th>故障类别</th><br>
                                    <td><input id="faultCategory" name="faultCategory"  class="easyui-textbox"      style="height: 22px;"  /></td>
                                </tr>
                            </div>
                        </div>
                        
                        <hr class="wide">
                        
                        <div class="row">
                        	<div class="col-md-4">
                        	<th>计划到达时间</th><br>
                                    <td><input id="planArriveTime" name="planArriveTime"  class="easyui-datetimebox"  required = "required"  style="width: 180px;" /></td>
                             </tr>
                        	</div>
                           
                            <div class="col-md-4">
                             <th>计划完成时间</th><br>
                                <td><input id="planFinishTime" name="planFinishTime"  class="easyui-datetimebox"  required = "required"  style="width: 180px;" /></td>
                             </tr>
                            </div>

                            <div class="col-md-4">
                                <tr>
		                            <th>任务类型</th><br>
                                    <td><input id="taskType"  name ="taskType"  class="easyui-textbox"    required = "required"   style="height: 22px;"  /></td>
                                </tr>
                            </div>
                        </div>
                        
                      <hr class="wide">
                        
                        <div class="row">
 
                             <div class="col-md-4">
	                            <tr>
		                            <th>客户级别</th><br>
                                    <td><input id="level" name="level"  class="easyui-textbox"      style="height: 22px;"  /></td>
                                </tr>
	                            </div>
                            <div class="col-md-4">
                            <tr>
		                            <th>交通方式</th><br>
                                    <td><input id="transportation" name= "transportation"  class="easyui-textbox"  required = "required"     style="height: 22px;"  /></td>
                                </tr>
                            </div>
                            <div class="col-md-4">
                            <tr>
		                            <th>联系人</th><br>
                                    <td><input id="contactName" name="contactName"  class="easyui-textbox"   required = "required"    style="height: 22px;"  /></td>
                                </tr>
                            </div>
                        </div>
                        
                         <hr class="wide">
                        
                        <div class="row">
                        	<div class="col-md-4">
                               <tr>
		                            <th>联系人职务</th><br>
                                    <td><input id="position" name="position"  class="easyui-textbox"  required = "required"     style="height: 22px;"  /></td>
                                </tr>
                        	</div>
                           
                            <div class="col-md-4">
                              <tr>
		                            <th>联系电话</th><br>
                                    <td><input id="fixedPhone" name="fixedPhone"  class="easyui-textbox"    style="height: 22px;"  /></td>
                                </tr>
                            </div>

                            <div class="col-md-4">
                             <tr>
		                            <th>联系手机</th><br>
                                    <td><input id="contactPhone"  name="contactPhone" class="easyui-textbox"   required = "required"    style="height: 22px;"  /></td>
                                </tr>
                            </div>
                        </div>
                         <hr class="wide">
                        
                        <div class="row">
                        	<div class="col-md-4">
                              <tr>
		                            <th>标准收费</th><br>
                                    <td><input id="charge" name="charge" class="easyui-textbox"   required = "required"    style="height: 22px;"  /></td>
                                </tr>
                        	</div>
                           
                            <div class="col-md-4">
                             <tr>
		                            <th>标准工时</th><br>
                                    <td><input id="workHours" name="workHours" class="easyui-textbox"  required = "required"     style="height: 22px;"  /></td>
                                </tr>
                            </div>

                            <div class="col-md-4">
                             <tr>
		                            <th>循环次数</th><br>
                                    <td><input id="loopTime" name="loopTime" class="easyui-textbox"      style="height: 22px;"  /></td>
                                </tr>
                            </div>
                        </div>
                         <hr class="wide">
                        
                        <div class="row">
                           <div class="col-md-6">
                           <h6>派单要求</h6>
                           <textarea class="form-control" name="sendDemand" rows="6" id="sendDemand"  placeholder="派单要求"></textarea>
                           </div>
                           
                           <div class="col-md-6">
	                       <h6>故障原因</h6>
	                       <textarea class="form-control" rows="6" id="issueReason" name="issueReason" placeholder="故障原因"></textarea>
	                       </div>
                    	</div>
                    	   <hr class="wide">
                    	 <div class="row">
                    	   <a  id="operateMode_reset"  style=" margin-left: 25%;" class="btn btn-success pull-left">重置</a>
                           <a id="operateMode_submit"  style=" margin-right: 25%;" class="btn btn-success pull-right">保存</a>
                    	</div>
                    	
                </div>
                
                </form>
                </div>
                
            	<!-- 人员名单 和 工作记录 -->
            	<div class="col-md-3">
					 <!--Widget person-->
				      	 <div class="row ">
				            <div class="col-lg-12 col-xs-12 col-md-12">
				                <div class="widget">
				                     <div class="widget-header bordered-bottom bordered-themesecondary">
                                  <i class="widget-icon fa fa-tags themesecondary"></i>
                                  <span class="widget-caption themesecondary">人员列表</span>
                              </div>
				                    <div class="widget-body configure">
				
				                        <div id="actionList"></div>
				                        <div id="page123"></div>
				                    </div>
				                </div>
				            </div>
				        </div>
		               <!--Widget person-->
                <div class="row">
                    <div class="col-lg-12">
                        <div class="widget">
                            <div class="widget-header bordered-bottom bordered-themesecondary">
                                <i class="widget-icon fa fa-tags themesecondary"></i>
                                <span class="widget-caption themesecondary">工作记录</span>
                            </div>
                            <div class="widget-body">
                                <div class="widget-main no-padding">
                                    <div class="tickets-container">
                                        <ul id="ticket-itemRecord" class="tickets-list">
                                           
                                        </ul>
                                    </div>
                                </div>
                            </div>
                           </div>
				                   
                        </div>

                      </div>
		            
                   </div> 
                 
            </div>
        </div>
        <!-- /页面内容 -->
    </div>
    <!-- 主容器 -->
</div>

<script type="text/javascript">

$("#ticket-itemRecord").append('<li class="ticket-item"><div class="row"><div class="ticket-type  col-lg-2 col-sm-6 col-xs-12"><span class="divider hidden-xs"></span><span class="type">Info</span></div></div></li>');
$("#ticket-itemRecord").append('<li class="ticket-item"><div class="row"><div class="ticket-type  col-lg-2 col-sm-6 col-xs-12"><span class="divider hidden-xs"></span><span class="type">Info</span></div></div></li>');

   
    //--Bootstrap Date Picker--
    $('.date-picker').datepicker();

    //--Bootstrap Time Picker--
    $('#timepicker1').timepicker();

    //--Bootstrap Date Range Picker--
    $('#reservation').daterangepicker();

    //--JQuery Autosize--
    $('#textareaanimated').autosize({ append: "\n" });

    //--Fuelux Spinner--
    $('.spinner').spinner();


    //--jQuery MiniColors--
    $('.colorpicker').each(function () {
        $(this).minicolors({
            control: $(this).attr('data-control') || 'hue',
            defaultValue: $(this).attr('data-defaultValue') || '',
            inline: $(this).attr('data-inline') === 'true',
            letterCase: $(this).attr('data-letterCase') || 'lowercase',
            opacity: $(this).attr('data-opacity'),
            position: $(this).attr('data-position') || 'bottom left',
            change: function (hex, opacity) {
                if (!hex) return;
                if (opacity) hex += ', ' + opacity;
                try {
                    console.log(hex);
                } catch (e) { }
            },
            theme: 'bootstrap'
        });

    });

    $.getJSON(ctx+'listSTaskSchedule.do',{},function(parentsJson) {
    	console.log(fw.serializeObject($('#form')));
    	console.log(parentsJson);
    	
    });
  
    //客户名称包含分页
    $.getJSON(ctx+'listAllSTaskSchedule.do?statusSch='+encodeURI(encodeURI("已发布")),{},function(parentsJson) {
    	$("#taskNum").val("G2016"+(parentsJson.rows[0].id));
    	pages('task_list',parentsJson.rows,3);
	});
  
    
    
    //确认提交操作
    $("#operateMode_submit").click(function() {
        if ($('#form').form('validate')) {
		        //添加
		        $.post(ctx+"addSTaskSchedule.do", fw.serializeObject($('form')), function(result,stauts) {
		            if (result.success) {
		            	$("#task_list li").remove();
		          	  //客户名称包含分页
		              $.getJSON(ctx+'listAllSTaskSchedule.do?statusSch='+encodeURI(encodeURI("已发布")),{},function(parentsJson) {
		              	$("#taskNum").val("G2016"+(parentsJson.rows[0].id));
		              	pages('task_list',parentsJson.rows,3);
		          	});
		            	alert(result.message);
		            	
		            }
		            else
		            {
		            	alert(stauts);
		            }
		        }, 'json');
        }
     });
       

      //确认提交操作
    $("#operateMode_release").click(function() {
    	 if ($('#form').form('validate')) {
		        //添加
		        console.log(fw.serializeObject($('form')))
		        $.post(ctx+"releaseSTaskSchedule.do", fw.serializeObject($('form')), function(result,stauts) {
		            if (result.success) {
		            	alert(result.message);
		            }
		            else
		            {
		            	alert(stauts);
		            }
		        }, 'json');
        }    
     })   
        
    // 重置功能
    $("#operateMode_reset").click(function() {
    	$("#form").form("reset");
    });
    
    // 重置功能
    $("#operateMode_new").click(function() {
    	$("#taskNum").val("G2016"+(parentsJson.rows[0].id+1));
    	$.getJSON(ctx+'listAllSUser.do',{idSch:userId },function(parentsJson) {
        	$("#createPerson").val(parentsJson.rows[0].trueName);
    	});
    	$("#form").form("reset");
    });
 

   function addTables(JsonDate , id, fieldArrays)
   {

	  var str = '';
	  str+='<thead><tr>';
	  str+='<th><div class="checker"><span class=""><input type="checkbox" class="group-checkable" data-set="#flip .checkboxes"></span></div></th>';
	  var keys = [];
	    for (var key in fieldArrays)
	    {
	    	keys.push(key);
	    	str+='<th>'+fieldArrays[key]+'</th>';
	    }
	    
	  str+='</tr></thead>';
	  str+='<tbody>';
	
	  for(var i = 0 ; i<JsonDate.rows.length;i++)
	  {     
		  str+='<tr>';
	  	  str+='<td><div class="checker"><span class=""><input type="checkbox" class="checkboxes" value="1"></span></div></td>'; 
		  var data = JsonDate.rows[i];
		  console.log(JsonDate.rows);
		  for(var key in data){
		  if(keys.indexOf(key) != -1 )
		  {
		 	str+='<td class="center "> '+ data[key] +'</td>';
	  	  }
	
	  }
		  str+='</tr>'; 
	  } 

	  str+='</tbody>';
	  document.getElementById(id).innerHTML =  str;
   }
  
   
   listActionByUser(1,5,false,'listSUser.do',"#actionList","#page123",["姓名"]);

             
</script>

</body>
</html>
